/*
 * ListAction.java
 *
 * Created on 29 marzec 2007, 21:08
 *
 */

package arocms.news;

import arocms.Constans;
import arocms.business.News;
import arocms.business.NewsDAO;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author arek
 */
public class ListAction extends Action{
    
        
    private Logger log = Logger.getLogger(this.getClass());

    private static final String SUCCESS = "success";
    private static final String FAILURE = "failure";
    
    /** Creates a new instance of ListAction */
    public ListAction() {
    }

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        List<News> newsy = new NewsDAO().findAll();
        request.setAttribute(Constans.NEWS_LIST_PATH, newsy);
        return mapping.findForward(SUCCESS);
    }
    
}
